home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / rayshade / main.c next >
C/C++ Source or Header  |  1991-08-08  |  2KB  |  109 lines

  1. /*
  2.  * main.c
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: main.c,v 4.0 91/07/17 14:50:39 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    main.c,v $
  19.  * Revision 4.0  91/07/17  14:50:39  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23.  
  24. char rcsid[] = "$Id: main.c,v 4.0 91/07/17 14:50:39 kolb Exp Locker: kolb $";
  25.  
  26. #include "rayshade.h"
  27. #include "options.h"
  28. #include "stats.h"
  29. #include "viewing.h"
  30. #include "picture.h"
  31.  
  32. int
  33. #ifdef LINDA
  34. rayshade_main(argc, argv)
  35. #else
  36. main(argc, argv)
  37. #endif
  38. int argc;
  39. char **argv;
  40. {
  41.     Float utime, stime, lasttime;
  42.     int i;
  43.     extern Geom *World;
  44.  
  45. #ifdef LINDA
  46.     Options.workernum = 0;    /* we're the supervisor */
  47. #endif
  48.  
  49.     RSInitialize(argc, argv);
  50.  
  51.  
  52.     /*
  53.      * Start the first frame.
  54.      */
  55.     RSStartFrame(Options.startframe);
  56.     /*
  57.       * Print more information than we'll ever need to know...
  58.      */
  59.     if (Options.verbose) {
  60.         /* World object info. */
  61.         AggregatePrintInfo(World, Stats.fstats);
  62.         /* Print info about rendering options and the like. */
  63.         RSOptionsList();
  64.     }
  65.     /*
  66.      * Start new picture.
  67.      */
  68.     PictureStart(argv);
  69.     /*
  70.      * Print preprocessing time.
  71.      */
  72.     RSGetCpuTime(&utime, &stime);
  73.     fprintf(Stats.fstats,"Preprocessing time:\t");
  74.     fprintf(Stats.fstats,"%2.2fu  %2.2fs\n", utime, stime);
  75.     fprintf(Stats.fstats,"Starting trace.\n");
  76.     (void)fflush(Stats.fstats);
  77.     lasttime = utime+stime;
  78.     /*
  79.      * Render the first frame
  80.      */
  81.     raytrace(argc, argv);
  82.     /*
  83.      * Render the remaining frames.
  84.      */
  85.     for (i = Options.startframe +1; i <= Options.endframe ; i++) {
  86.         PictureFrameEnd();    /* End the previous frame */
  87.         RSGetCpuTime(&utime, &stime);
  88.         fprintf(Stats.fstats, "Total CPU time for frame %d: %2.2f \n", 
  89.             i - 1, utime+stime - lasttime);
  90.         PrintMemoryStats(Stats.fstats);
  91.         (void)fflush(Stats.fstats);
  92.         lasttime = utime+stime;
  93.         RSStartFrame(i);
  94.         if (Options.verbose) {
  95.             AggregatePrintInfo(World, Stats.fstats);
  96.             (void)fflush(Stats.fstats);
  97.         }
  98.         PictureStart(argv);
  99.         raytrace(argc, argv);
  100.     }
  101.     /*
  102.      * Close the image file.
  103.      */
  104.     PictureFrameEnd();    /* End the last frame */
  105.     PictureEnd();
  106.     StatsPrint();
  107.     return 0;
  108. }
  109.